package com.zb.uniman.common;

import lombok.Data;

/**
 * Author:B
 * Description:
 */
@Data
public class ResultMap<T extends Object> {

    private int code;

    private T data;
    private String msg;

    public ResultMap() {

    }

    public static ResultMap error(ErrorCode errorCode){
        return new ResultMap<>(errorCode.getCode(), errorCode.getMsg(),null);
    }
    public ResultMap(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public ResultMap(int code, T data) {
        this.code = code;
        this.data = data;
    }

    public ResultMap(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

//泛型和static不能一起用
}
